#!/bin/sh
#
# $Id$
#
# makedroid: build Android application for old scool
#
# (c)opyleft 2011 Vsevolod S. Balashov <vsevolod@balashov.name>
# distributed under terms of GNU LGPL v3
#
# just symlink me somewhere in $PATH

[ -f AndroidManifest.xml ] || {
    echo "run me in Android project dir (instead 'make' command)"
    exit 1
}

read_link() {
    link=$1
    while [ -L $link ]; do
        link=`readlink $link`;
    done
}

read_link $0
mydir=`dirname $link`

makefile=$mydir/Makefile.android

sdk=`which android`
[ -x $sdk ]  && {
    read_link $sdk
    sdk=`dirname $link` #remove android
    sdk=`dirname $sdk` #remove tools
}

mkapk_sdk_dir=$sdk mkapk_proguard_cfg=$mydir/proguard.cfg make -f $makefile $*
